]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search: Remove callback on updateSearch and only rely on async API
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Mon, 16 Feb 2026 20:45:09 +0000 (21:45 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 17 Feb 2026 14:00:13 +0000 (14:00 +0000)
Using a callback in an async function does not make much sense, so let's
just use the async API

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4080>

js/ui/search.js

index 32a934f435fbb18044bb8223aaa5af0a8af26747..361475e2f24dd9d3b32d2ed956e8c2bf1dd7645a 100644 (file)
@@ -250,12 +250,11 @@ const SearchResultsBase = GObject.registerClass({
         });
     }
 
-    async updateSearch(providerResults, terms, callback) {
+    async updateSearch(providerResults, terms) {
         this._terms = terms;
         if (providerResults.length === 0) {
             this._clearResultDisplay();
             this.hide();
-            callback();
         } else {
             const maxResults = this._getMaxDisplayedResults();
             const results = maxResults > -1
@@ -275,10 +274,8 @@ const SearchResultsBase = GObject.registerClass({
                     resultId => this._addItem(this._resultDisplays[resultId]));
                 this._setMoreCount(this.provider.canLaunchSearch ? moreCount : 0);
                 this.show();
-                callback();
             } catch {
                 this._clearResultDisplay();
-                callback();
             }
         }
     }
@@ -705,7 +702,7 @@ export const SearchResultsView = GObject.registerClass({
         }
 
         this._results[provider.id] = results;
-        this._updateResults(provider, results);
+        await this._updateResults(provider, results);
     }
 
     _doSearch() {
@@ -851,16 +848,18 @@ export const SearchResultsView = GObject.registerClass({
         }
     }
 
-    _updateResults(provider, results) {
+    async _updateResults(provider, results) {
         const terms = this._terms;
         const display = provider.display;
 
-        display.updateSearch(results, terms, () => {
+        try {
+            await display.updateSearch(results, terms);
+        } finally {
             provider.searchInProgress = false;
 
             this._maybeSetInitialSelection();
             this._updateSearchProgress();
-        });
+        }
     }
 
     activateDefault() {